//app.js
var utils = require('utils/util.js');
App({
    onLaunch: function() {},
    makeLogin: function(callback) {
        var that = this;
        // 登录
        wx.login({
            success: res => {
                // 发送 res.code 到后台换取 openId, sessionKey, unionId
                utils.showLoading("正在登陆");
				console.log(that.globalData.inv_id,"获取invid")
				utils.http("/api/v1/login/index_wx", {
                    js_code: res.code,
					inv_id: that.globalData.inv_id
                }, (res) => {
                    console.log(res);
                    utils.hideLoading();
                    that.globalData.key = res.datas.key;
                    if (typeof callback == 'function') {
                        callback();
                    }
                })
            }
        })
    },
    globalData: {
        userInfo: null,
        http: "https://www.tglq.top/index.php",
    }
})